//商品相关接口
import request from "@/utils/request.ts";
import { Trademark, TypePageTrademark } from "./type";
// 品牌接口

enum API {
  // 关键字查询品牌
  // GET
  findTrademark = "/admin/product/baseTrademark/findBaseTrademarkByKeyword",
  // 获取品牌信息
  // GET
  getTrademark = "/admin/product/baseTrademark/get",
  // 获取品牌列表
  // GET
  getTrademarkList = "/admin/product/baseTrademark/getTrademarkList",
  // 查询品牌id列表
  // POST
  findTrademarkList = "/admin/product/baseTrademark/inner/findBaseTrademarkByTrademarkIdList",
  // 删除品牌
  // DELETE
  deleteTrademark = "/admin/product/baseTrademark/remove",
  // 添加品牌
  // POST
  saveTrademark = "/admin/product/baseTrademark/save",
  // 修改品牌
  // PUT
  updateTrademark = "/admin/product/baseTrademark/update",
  // 分页列表
  // GET
  pageTrademark = "/admin/product/baseTrademark",
}

export const reqFindTrademark = (keyword: string) =>
  request.get<any, any>(API.findTrademark + `/${keyword}`);
//获取单个品牌数据
export const reqGetTrademark = (id: number) =>
  request.get<any, any>(API.getTrademark + `/${id}`);

export const reqGetTrademarkList = () =>
  request.get<any, any>(API.getTrademarkList);

export const reqFindTrademarkList = () =>
  request.post<any, any>(API.findTrademarkList);

export const reqDeleteTrademark = (id: number) =>
  request.delete<any, any>(API.deleteTrademark + `/${id}`);
//添加品牌接口
export const reqSaveTrademark = (data: Trademark) =>
  request.post<any, any>(API.saveTrademark, data);
//修改品牌接口
export const reqUpdateTrademark = (data: Trademark) =>
  request.put<any, any>(API.updateTrademark, data);
//获取分页品牌接口
export const reqPageTrademark = (page: number, limit: number) =>
  request.get<any, TypePageTrademark>(API.pageTrademark + `/${page}/${limit}`);
